﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsoleApplication3.AbstraX;
using System.Diagnostics;
using System.Collections;
using AbstraX.ServerInterfaces;
using AssemblyProvider.Web.Entities;

namespace ConsoleApplication3
{
    class Program
    {
        static void Recurse(IRoot root)
        {
            foreach (var element in root.RootElements)
            {
                Action<IElement> print = null;

                print = elem =>
                {
                    Debug.WriteLine(elem.Name);
                    Debug.Indent();

                    elem.ChildElements.ToList().ForEach(childelem => print(childelem));

                    Debug.Unindent();
                };

                print(element);
            }
        }

        static void Main(string[] args)
        {
            var solutionName = @"C:\Users\Ken\Documents\visual studio 2010\Projects\ConsoleApplication3\ConsoleApplication3.sln";

            using (var assembliesRoot = new AssembliesRoot())
            {
                try
                {
                    Recurse(assembliesRoot);
                }
                catch (Exception ex)
                {
                    Debugger.Break();
                }
            }

            using (var solution = new Root(solutionName))
            {
                try
                {
                    Recurse(solution);
                }
                catch (Exception ex)
                {
                    Debugger.Break();
                }
            }
        }
    }
}
